home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2177 < prev    next >
Encoding:
Text File  |  1996-08-06  |  5.2 KB  |  117 lines

  1. Path: news.cc.uic.edu!sunphy1!olczyk
  2. From: olczyk@sunphy1 (Thadeus Olczyk)
  3. Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
  4. Subject: Re: C++ with Zapp vs. Delphi
  5. Followup-To: comp.lang.c++,comp.lang.pascal.delphi.misc
  6. Date: 16 Jan 1996 08:32:41 GMT
  7. Organization: University of Illinois at Chicago
  8. Message-ID: <4dfnr9$4c02@tigger.cc.uic.edu>
  9. References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <Eul+w0JfFyQD089yn@oslonett.no>
  10. NNTP-Posting-Host: sunphy1.phy.uic.edu
  11.  
  12. Unfortunately it was late two hours ago.
  13. I will follow up more thoroughy later but there were two parts I couldn't
  14. resist.
  15. Rune Moberg (mobergru@oslonett.no) wrote:
  16. : Anyway, in Bjarne's book about C++, which I haven't actually read, I just
  17. : looked up "polymorphism", and Bjarne says (this can take a while, I
  18. : type slow, since my keyboard has a sticky n-key):
  19. : "Pointers to functions can be used to provide polymorphic routines, that
  20. : is routines that can be applied to objects of many different types:
  21.  
  22. :   typedef int (*CFT) (void*,void*);
  23. :   void sort(void* base, unsigned n, unsigned int sz, CFT cmp)"
  24. : (don't worry, the n-key wasn't sticky after all, so typing went ahead
  25. : at full speed. Bjarne mentions MI a couple of places (4), but not as
  26. : a requirement for polymorphism)
  27.  
  28. : Now, I have some C experience (half a year), but the above is totally
  29. If you can't read the above then your half year of experience was rather 
  30. poor. Unfortunately the biggest fraud in the computer world are the shelves
  31. filled with books entitled "Teach Yourself xxx in 21 day for complete
  32. morons who want to unlease $60 instead of $30 for the good book lying
  33. on the bottom shelf covered with dust." 
  34.  
  35. : unreadable to me (the function header). Anyway, the concept is familiar;
  36. : you have a function (or preferably a method) who accept an object as a
  37. : parameter.
  38.  
  39. Bjarne's book is meant for experienced C programmers. Meaning programmers who 
  40. can read that code. Lipman is a better book for beginers. His point is
  41. that you can do OO in C ( preC++). The example is one of the first examples of
  42. polymorphism. Furthermore in C++ it would read 
  43.  
  44. class SortedList
  45. {
  46. ...
  47. }
  48.  
  49. class SortedObject
  50. {
  51. ...
  52. virtual boolean CompareTo();
  53. ...
  54. }
  55.  
  56. class MyOb:public SortedObject
  57. {
  58. ....
  59. boolean CompareTo();
  60. ...
  61. }
  62.  
  63. : So far, this is very possible in Object Pascal, and a concept heavily
  64. : used by Delphi. When you put a component on a form, you can attach event
  65. : handlers. The parameter of an event handler is "Sender" of type TObject,
  66. : thus I can share the same event handler among different components,
  67. : and use typecasting whenever I need to reference something specific to
  68. : a child object.
  69. : thus:
  70. :   (Sender as TEdit).CutToClipboard;
  71. : will work for TEdit and all descendants of TEdit, but will generate an
  72. : exception for any other object.
  73.  
  74. : Object Pascal has a different type cast (also available in Delphi) that
  75. : instead of generating an exception will most probably crash (AFAIK):
  76. :   TEdit(Sender).CutToClipboard;  {a somewhat more direct approach}
  77. For an event this is fine. But for a method it's not. A method won't know 
  78. what components might be sent to it. So you have to write that line for
  79. each component. Of course if you buy new components, you have to add them
  80. to the method. The class that contains that method can never be declared
  81. closed to change ( save for bug fixes ). That's a mainenance nightmare.
  82.  
  83. : >Let's. RAD has recently come into disfavor in publications like JOOP, Object,
  84. : >and even Byte. Last summer InfoWorld reported a growing disillusionment
  85.  
  86. : Borland has a couple of big customers that have shared their success
  87. : stories with the public. Remember, Delphi isn't even a year old, so the
  88. : publications you've mentioned aren't really uptodate. I even emailed a guy
  89. : who wrote a piece for Byte last year (about RAD, summer issue), and he
  90. : thought Delphi was ok. RAD so far has meant VB. Delphi is not VB. Granted,
  91. : it's simple to use, but it's powerful at the same time.
  92. The articles did not trash RAD tools, they trashed RAD.
  93. As for the projects that you mention they can only be slightly older then one 
  94. year. That means that it's not possible to judge their success or failure.
  95. And of course, all this follows Fred Brooks outline of new proccesses that
  96. eventually failed.
  97.  
  98. : VC++'s MFC library doesn't make much use of inheritance at all, does it?
  99. : Atleast that's what I've been told from someone residing in one of the
  100. : C++ newsgroup (maybe it was a troll, but I've heard it elsewhere as well,
  101. : MFC is supposedly bad OOP)?
  102. From Allen Holub's book Enough Rope to Shoot Yourself in the Foot.
  103.  
  104. The programming and design problems discussed here are not student code,
  105. unfortunately.
  106. Many of the examples of how not to do thingsd are taken from a commercial
  107.  product:
  108. the Microsoft Foundation Class (MFC) library. As far as I can tell, this 
  109. library was designed without a thought to good maintenance, by people unaware 
  110. of even rudimentary object-oriented design principles.
  111.  
  112. As for grades I wouldn't boast of high grades in this day and age. In Dec 94 
  113. the Chicago Tribune ran an article which said that half of the graduating
  114. college students couldn't read. Many of these were straight A students.
  115. -----------------------------------
  116. Thaddeus L. olczyk
  117.